<!--
  -- 描述：职位下拉列表，可以用v-model双向绑定数据
  --
  -- 作者：cyq
  -- 时间：2018/9/1 12:39
-->
<template>
  <el-select placeholder="请选择职位" :value="mval" @change="selectHandler" :clearable=true :multiple="multiple" collapse-tags>
    <el-option v-for="(item, index) in list" :key="index" :label="item.text" :value="item.id"></el-option>
  </el-select>
</template>

<script>
    export default {
      name: "PositionSelect",
      model: {
        prop: 'mval',
        event: 'modelValue'
      },
      props: ['mval','multiple'],
      mounted: function() {
        this.api.post('/bucket-system/system/dict/all', {'code': 'zw'})
          .then((data) => {
            this.list = data.data;
          });
      },
      data() {
        return {
          list: []
        }
      },
      methods: {
        selectHandler: function(val){
          this.$emit('modelValue', val)
        }
      }
    }
</script>
